// 引入axios
import axios from 'axios'
import { getItem } from './storage'

export const request = axios.create({
  baseURL: 'http://geek.itheima.net/'
})

// 请求拦截器
request.interceptors.request.use(config => {
  if (getItem('geek-client-pc-store') && getItem('geek-client-pc-store').token) {
    config.headers.Authorization = `Bearer ${getItem('geek-client-pc-store').token}`
  }
  return config
})
